#include <bits/stdc++.h>

using namespace std;
//#define int long long
const int inf = 0x3f3f3f3f;

void solve()
{
    unsigned int n;
    cin >> n;
    string s;
    for (int i = 31; i >= 0; i--) s += to_string(n >> i & 1);
    string t;
    for (int i = 16; i < 32; i++) t += s[i];
    for (int i = 0; i < 16; i++) t += s[i];
    unsigned int ans = 0;
    for (int i = 31; i >= 0; i--) if (t[31 - i] == '1') ans += (1 << i);
    cout << ans;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int _ = 1;
    //cin >> _;
    while (_--)
    {
        solve();
    }
    return 0;
}